public class Circle {
    private double radius; 
    public void setRadius(double r) {
        if (r > 0) {
            radius = r;
        } else {
            System.out.println("输入的半径不合法，请输入大于0的半径值");
        }
    }

    public double getRadius() {
        return radius;
    }

    public double mianji() {
        return Math.PI * radius * radius;
    }

    public double zhouchang() {
        return 2 * Math.PI * radius;
    }

    public static void main(String[] args) {
        Circle circle = new Circle();
        java.util.Scanner scanner = new java.util.Scanner(System.in);
        System.out.println("请输入圆的半径: ");
        double inputRadius = scanner.nextDouble();
        circle.setRadius(inputRadius);

        System.out.println("圆的半径为: " + String.format("%.2f", circle.getRadius()));
        System.out.println("圆的面积为: " + String.format("%.2f", circle.mianji()));
        System.out.println("圆的周长为: " + String.format("%.2f", circle.zhouchang()));

        scanner.close();
    }
}
